package com.lyz.jingjie;

import java.util.ArrayList;

/**
 * @ClassName GenericityTest4
 * @Description 泛型通配 ? 上限 下限
 * @Author 2214361854
 * @Date 2022/2/21 17:57
 * @Version 1.0
 */
public class GenericityTest4 {
    public static void main(String[] args) {
        ArrayList<BMW> bmws =  new ArrayList<>();
        bmws.add(new BMW());
        go(bmws);

        ArrayList<BENZ> benz =  new ArrayList<>();
        benz.add(new BENZ());
        go(benz);
    }
    public static void go(ArrayList<? extends Car> cars){
        System.out.println(cars);
    }
}

class BENZ extends Car{

}
class BMW extends Car{

}

class Car{

}